using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;

namespace System.Web.Core
{
    internal class EntityManager
    {
        private static EntityProvider entityProvider = Configuration.Instance.Providers["EntityProvider"] as EntityProvider;

        public static void SwitchProvider(EntityProvider provider)
        {
            entityProvider = provider;
        }
        public static void ResetProvider()
        {
            entityProvider = Configuration.Instance.Providers["EntityProvider"] as EntityProvider;
        }

        public static EntityList GetEntityList(BaseRequestBinder requestBinder)
        {
            return entityProvider.GetEntityList(requestBinder);
        }
        public static Entity GetEntity(BaseRequestBinder requestBinder)
        {
            return entityProvider.GetEntity(requestBinder);
        }
        public static SqlResult CreateEntity(BaseRequestBinder requestBinder)
        {
            return entityProvider.CreateEntity(requestBinder);
        }
        public static SqlResult UpdateEntity(BaseRequestBinder requestBinder)
        {
            return entityProvider.UpdateEntity(requestBinder);
        }
        public static SqlResult DeleteEntity(BaseRequestBinder requestBinder)
        {
            return entityProvider.DeleteEntity(requestBinder);
        }
        public static SqlResult ExecuteTransaction(List<BaseRequestBinder> requestBinders)
        {
            return entityProvider.ExecuteTransaction(requestBinders);
        }
    }
}